<?php
require_once 'interface.php';
class mSuccess
{
    use \control\interfaces;

    public string $date;
    public string $time;
    /**
     * 执行
     */

    public function __construct()
    {
        // 启用扩展
        $this->init();
        $this->date = date('Y-m-d');
        $this->time = date('Y-m-d H:i:s');
    }

    private function head($title = ""): string
    {
        $root = root;
        $version = version;
        $css = <<<EOT
	<link href="{$root}static/stylesheet/animate.min.css?v=$version" rel="stylesheet">
		<link href="{$root}static/stylesheet/m.css?v=$version" rel="stylesheet">
EOT;
        $js = <<<EOT
	<script src="{$root}static/javascript/js.js?v=$version"></script>
EOT;
        $meta = "
	<meta name='viewport' content='width=device-width,initial-scale=1.0,viewport-fit=cover'>
	<meta name='apple-mobile-web-app-capable' content='yes'>
	<meta name='apple-mobile-web-app-status-bar-style' content='black'>
	<meta name='format-detection' content='telephone=no,email=no,adress=no'>
		";
        if (empty($title)) {
            $title = para("title");
        }
        $keywords = para("keywords");
        $description = para("description");
        return <<<EOT
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta name="keywords" content="$keywords">
	<meta name="description" content="$description">
	<title>$title</title>
$meta $css
	<link href="{$root}favicon.ico?v=$version" rel="Bookmark">
	<link href="{$root}favicon.ico?v=$version" rel="icon">
	<link href="{$root}favicon.ico?v=$version" rel="shortcut icon">
	<link href="{$root}favicon.ico?v=$version" rel="apple-touch-icon">
	<script src="{$root}static/javascript/jquery-1.11.2.min.js?v=$version"></script>
	<script src="{$root}static/javascript/lib.js?v=$version"></script>
	<script src="{$root}static/plugins/laydate/laydate.js?v=$version"></script>
$js
	<script>
	let root = '$root';
	</script>
</head>
<body>

EOT;
    }

    /*底部*/
    private function footer(): string
    {
        return <<<eof
</body>
		</html>
eof;

    }

    /*返回*/
    public function indexHtml(): string
    {
        $html = $this->contentHtml();
        //返回
        return $this->head() . $html .$this->footer();
    }

    private function contentHtml(): string
    {
        $success = root.'img/control/success.png';
        return <<<eof
<div class="success-content-page">
    <div class="font-center">
        <img class="success-ico" src="$success">
        <p style="margin-top: 10px">提交成功</p>
    </div>
</div>
eof;
    }

}

//实例化对象
$mSuccess = new mSuccess();
//打印结果
echo $mSuccess->indexHtml();

